
import './App.css'
import Login from './pages/Login'
import Edit from './pages/Edit'
import List from './pages/List'
import { BrowserRouter as Router, Routes, Route, Navigate } from 'react-router-dom'

// 定义受保护的路由
const protectedRoutes = [
  { path: '/', element: <List /> },
  { path: '/List', element: <List /> },
  { path: '/edit', element: <Edit /> },
]

function App() {
  const isAuthenticated = false; 

  return (
    <Router>
      <Routes>
        <Route path="/login" element={<Login />} />
         {/* 受保护的路由 */}
        {protectedRoutes.map((route) => (
          <Route
            key={route.path}
            path={route.path}
            element={isAuthenticated ? route.element : <Navigate to="/login" />}
          />
        ))}
      </Routes>
    </Router>
  )
}

export default App
